function isFunction(obj) {
    return Object.prototype.toString.call(obj) === '[object Function]';
}

function useExt(name) {
    let ext = gl.getExtension(name);
    if (!ext) {
        throw `load ext:${name} failed!`;
    }

    for (let k in ext) {
        if (isFunction(ext[k]) && !gl.hasOwnProperty(k)) {  // eslint-disable-line
            gl[k] = ext[k].bind(ext);
            console.log('===== 添加扩展方法:', k);
        }
    }
}

module.exports = {
    useExt:useExt,
};
